Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: L1 NFT attributes #3474

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

jorgemmsilva
Copy link
Contributor

getTokenURI currently does not correctly return the attributes from L1 NFTs metadata.

due to an array of mappings to arbitrary types (JSON) being very hard to represent in Solidity, I opted to remove the attributes field from the getIRC27NFTData function.

@jorgemmsilva jorgemmsilva enabled auto-merge July 17, 2024 16:31
@@ -14,10 +14,10 @@ type IRC27NFTMetadata struct {
Royalties map[string]float32 `json:"royalties,omitempty"`
IssuerName string `json:"issuerName,omitempty"`
Description string `json:"description,omitempty"`
Attributes string `json:"attributes,omitempty"`
Attributes []interface{} `json:"attributes,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: []any is shorter :)

Also: json.RawMessage does not work for this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I had auto-merge enabled :/ . Good points tho, thanks 👍

json.RawMessage unfortunately makes this test fail because it strips the whitespace:

        	            	- Attributes: (json.RawMessage) (len=37) {
        	            	-  00000000  7b 22 74 72 61 69 74 5f  74 79 70 65 22 3a 20 22  |{"trait_type": "|
        	            	-  00000010  46 6f 6f 22 2c 20 22 76  61 6c 75 65 22 3a 20 22  |Foo", "value": "|
        	            	-  00000020  42 61 72 22 7d                                    |Bar"}|
        	            	+ Attributes: (json.RawMessage) (len=34) {
        	            	+  00000000  7b 22 74 72 61 69 74 5f  74 79 70 65 22 3a 22 46  |{"trait_type":"F|
        	            	+  00000010  6f 6f 22 2c 22 76 61 6c  75 65 22 3a 22 42 61 72  |oo","value":"Bar|
        	            	+  00000020  22 7d                                             |"}|
        	            	  

@jorgemmsilva jorgemmsilva merged commit 7a3ba7e into iotaledger:develop Jul 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants